/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import classededados.Cliente;
import conexao.Conexao;
import interfaces.ClienteInterface;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author weverson
 */
public class ClienteDao implements ClienteInterface {

    private Connection conectar = null;

    public ClienteDao() {
        try {
            conectar = Conexao.getConexao();
        } catch (Exception ex) {
            Logger.getLogger(ClienteDao.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @Override
    public void incluir(Cliente objCliente) throws SQLException {
        String comando = "insert into cliente(nome,"
                + "cpf,"
                + "rg,"
                + "endereco,"
                + "senha_principal,"
                + "senha_login,"
                + "values(?,?,?,?,?,?)";

        PreparedStatement ps = conectar.prepareStatement(comando);

        ps.setString(1, objCliente.getNome());
        ps.setString(2, objCliente.getCpf());
        ps.setInt(3, objCliente.getRg());
        ps.setString(4, objCliente.getEndereco());
        ps.setString(5, objCliente.getSenhaPrincipal());
        ps.setString(6, objCliente.getSenhaLogin());

        ps.executeUpdate();
        ps.close();
    }

}
